
public class TwoToOne {

	public static void main(String[] args) {

		int TwoDim[][] = new int[3][3];
		int OneDim[] = new int[9];
		int k = 0;
		int a = 0;
		for (int i=0; i < TwoDim.length; i++)
			for (int j=0; j < TwoDim.length; j++)
			{
				TwoDim[i][j] = k;
				k++;
				//System.out.println("" +TwoDim[i][j]);
			}
		for (int i=0; i<3; i++)
		{
			System.out.println(" "+TwoDim[i][0]+ " "+TwoDim[i][1]+ " "+TwoDim[i][2]+ "\n");
		}
		
		
		for (int i=0; i <= 2; i++)
			for (int j=0; j <=2; j++)
			{
				OneDim[a] = TwoDim[i][j];
				System.out.println("" +OneDim[a++]);
			}
		
		
	}

}
